require 'spec_helper'
require 'game_object'

describe GameObject, "hit detection" do
  before(:each) do
    @obj = GameObject.new
    @obj.position = Point.new([195, 195])
    @obj.width = 20
    @obj.height = 20
  end
  
  it "should return true on #within? if point is within object bounds" do
    p = Point.new([200, 200])
    @obj.hit?(p).should == true
  end
  
  it "should return false on #within? if point is outside object bounds" do
    p = Point.new([500, 500])
    @obj.hit?(p).should == false
  end
end